import http from '@/utils/http2.js'

/**
 * 保存采购单
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function savePurchase(data){
  return http.post("/api/purchase",data)
}

/**
 * 采购单列表
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function queryPurchase(data){
  return http.post("/api/purchase/list",data)
}

/**
 * 批量删除采购单
 * @param ids
 * @returns {Promise<axios.AxiosResponse<*>>}
 */
export function deletePurchase(ids){
  return http.delete("/api/purchase?ids="+ids,{})
}

/**
 * 导出采购单
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function exportPurchase(data){
  return http.post("/api/purchase/exportPru",data)
}

/**
 * 审核采购单
 * @param data
 * @returns {Promise<axios.AxiosResponse<*>>}
 */
export function auditPurchase(data){
  return http.put("/api/purchase/status",data)
}

/**
 * 详情
 * @param id
 * @returns {Promise<axios.AxiosResponse<*>>}
 */
export function getDetail(id){
  return http.get("/api/purchase",{id})
}
/**
 * 修改
 * @param {*} data
 * @returns
 */
export function updatePurchase(data){
  return http.put("/api/purchase",data)
}

/**
 * 查询仓库
 * @param id
 * @returns {*}
 */
export function getWarehouse(id){
  return http.get("/api/report/warehouse?id="+id,{})
}

